package mylibrary.xml.demo.suit;

import org.w3c.dom.Document;
import org.w3c.dom.Element;

public class EncryptionMethod {

	private Element encMethod = null;
	
	private Document doc = null;
	
	private boolean elementAppendedToDoc = false;
	
	public EncryptionMethod(Document document) {
		doc = document;
		encMethod = doc.createElement("EncryptionMethod");
	}
	
	public void setAlgorithm(int algoNo) {
		encMethod.setAttribute("Algorithm", AlgoNames.getAlgoNSValue(algoNo));
	}
	
	public Document getEncMethod() {
		if(elementAppendedToDoc == false) {
			doc.appendChild(encMethod);
			elementAppendedToDoc = true;
		}
		return doc;
	}
}
